import {messages} from "share/common";
import {Popconfirm} from 'antd';
export default {
  getBaseInfoAttr(){
    return [
      {title: messages('supplier.key951')/*询价状态*/ ,dataIndex: 'statusDesc'},
      {title: messages('supplier.key955')/*询价次数*/ ,dataIndex: 'count'},
      {title: messages('supplier.key952')/*申请单号*/ ,dataIndex: 'businessCode'},
      {title: messages('supplier.key956')/*预订人公司名称*/ ,dataIndex: 'companyName'},
      {title: messages('supplier.key953')/*预订人姓名*/ ,dataIndex: 'userName'},
      {title: messages('supplier.key954')/*预订人工号*/ ,dataIndex: 'employeeNo'},
      {title: messages('supplier.key957')/*预订人联系电话*/ ,dataIndex: 'mobilePhone'},
      {title: messages('supplier.key958')/*预订人联系邮箱*/ ,dataIndex: 'email'},
      {title: messages('supplier.key959')/*RFP备注*/ ,dataIndex: 'remark'},
      {title: messages('supplier.key1079')/*预订偏好*/ ,dataIndex: 'preference'},
    ]
  },
  getJourneyColumns(){
    return [
      {title: messages('supplier.key960')/*行程单号*/, dataIndex: 'businessCode', key: 'businessCode'},
      {
        title: messages('supplier.key328')/*行程类型*/, dataIndex: 'itineraryType', key: 'itineraryType',
        render: (value) => {
          switch (value){
            case 1: return messages('supplier.key1080')/*单程*/;
            case 2: return messages('supplier.key1081')/*往返*/;
            default: return '';
          }
        }
      },
      {title: messages('supplier.key961')/*出发日期*/, dataIndex: 'departDate', key: 'departDate'},
      {title: messages('supplier.key962')/*浮动天数*/, dataIndex: 'departDateFloatDay', key: 'departDateFloatDay'},
      {title: messages('supplier.key963')/*返回日期*/, dataIndex: 'returnDate', key: 'returnDate'},
      {title: messages('supplier.key964')/*出发地*/, dataIndex: 'departureCity', key: 'departureCity'},
      {title: messages('supplier.key965')/*目的地*/, dataIndex: 'arrivalCity', key: 'arrivalCity'},
      {title: messages('supplier.key966')/*折扣*/, dataIndex: 'maxDiscount', key: 'maxDiscount'},
      {title: messages('common.amount')/*金额*/, dataIndex: 'maxPrice', key: 'maxPrice'},
      {title: messages('supplier.key624')/*舱等*/, dataIndex: 'cabinClassName', key: 'cabinClassName'},
      {title: messages('supplier.key967')/*行程备注*/, dataIndex: 'remark', key: 'remark'},
    ]
  },
  getPassengersColumn(){
    return [
      {title: messages('supplier.key968')/*姓*/, dataIndex: 'surName', key: 'surName'},
      {title: messages('supplier.key969')/*名*/, dataIndex: 'givenName', key: 'givenName'},
      {title: messages('common.user.id')/*工号*/, dataIndex: 'employeeNo', key: 'employeeNo'},
    ]
  },
  getQuotationColumn(onOperator){
    return [
      {title: messages('supplier.key970')/*方案生成日期*/, dataIndex: 'createdDate', key: 'createdDate'},
      {title: messages('supplier.key971')/*方案ID*/, dataIndex: 'schemeNo', key: 'schemeNo'},
      {title: messages('supplier.key972')/*方案标签*/, dataIndex: 'title', key: 'title'},
      {title: messages('common.column.status')/*状态*/, dataIndex: 'schemeStatusDesc', key: 'schemeStatusDesc'},
      {title: messages('supplier.key973')/*方案添加人员*/, dataIndex: 'createdBy', key: 'createdBy'},
      {title: messages('common.total.amount')/*总金额*/, dataIndex: 'totalAmount', key: 'totalAmount'},
      {
        title: messages('common.operation')/*操作*/, dataIndex: 'operator', key: 'operator',
        width: 226,
        render: (v, record) => {
          let operator = [];
          switch (record.schemeStatus){
            case 10: operator = [
              {name: messages('supplier.key1062')/*删除方案*/, onTapType: 'delete'},
              {name: messages('supplier.key1063')/*停用方案*/, onTapType: 'stop'},
              {name: messages('supplier.key1064')/*方案详情*/, onTapType: 'detail'},
            ]
              break;// 待用户确认
            case 20: operator = [
              {name: messages('supplier.key1065')/*预订成功*/, onTapType: 'success'},
              {name: messages('supplier.key884')/*预订失败*/, onTapType: 'fail'},
              {name: messages('supplier.key1064')/*方案详情*/, onTapType: 'detail'},
            ]
              break;// 用户已确认
            case 30: operator = [
              {name: messages('supplier.key1062')/*删除方案*/, onTapType: 'delete'},
              {name: messages('supplier.key1064')/*方案详情*/, onTapType: 'detail'},
            ]
              break;// 停用
            case 40: operator = [
              {name: messages('supplier.key1064')/*方案详情*/, onTapType: 'detail'},
            ]
              break;// 预订失败
            case 50: operator = [
              {name: messages('supplier.key1064')/*方案详情*/, onTapType: 'detail'},
            ]
              break;// 预订成功
            case 60: operator = []
              break;// 删除方案
          }
          return (
            <div>
              {
                operator.map(item => {
                  if(item.onTapType === 'delete'){
                    return (
                      <Popconfirm
                        title={messages('supplier.key1066')/*是否删除该方案*/}
                        onConfirm={()=>onOperator(item.onTapType, record)}>
                        <a style={{marginRight: 6}} onClick={(eve)=>{eve.stopPropagation()}}>{item.name}</a>
                      </Popconfirm>
                    )
                  }
                  return (
                    <a style={{marginRight: 6}} onClick={()=>onOperator(item.onTapType, record)}>{item.name}</a>
                  )
                })
              }
            </div>
          )
        }
      },
    ]
  },
  getColumns(){
    return [
      {
        title: messages('supplier.key974')/*询价时间*/,
        dataIndex: 'createdDate',
        key: 'createdDate',
      },
      {
        title: messages('supplier.key952')/*申请单号*/,
        dataIndex: 'businessCode',
        key: 'businessCode',
      },
      {
        title: messages('common.column.status')/*状态*/,
        dataIndex: 'statusDesc',
        key: 'statusDesc',
      },
      {
        title: messages('supplier.key955')/*询价次数*/,
        dataIndex: 'count',
        key: 'count',
      },
      {
        title: messages('supplier.key975')/*预订人公司*/,
        dataIndex: 'companyName',
        key: 'companyName',
      },
      {
        title: messages('supplier.key953')/*预订人姓名*/,
        dataIndex: 'userName',
        key: 'userName',
      },
      {
        title: messages('supplier.key954')/*预订人工号*/,
        dataIndex: 'employeeNo',
        key: 'employeeNo',
      },
      {
        title: messages('supplier.key976')/*已报价次数*/,
        dataIndex: 'quoteCount',
        key: 'quoteCount',
      },
    ]
  }
}
